package cn.gson.springmvc.model.pojos;

import javax.persistence.*;
import java.util.Collection;
import java.util.Objects;

@Entity
public class Inventory {
    private int inventoryNumber;
    private Long inventoryQuantity;
    private Integer inventoryKF;
    private Integer inventoryMZ;
    private Long inventoryDetailsBatch;
    private Long inventoryDetailsQuantity;
    private Collection<DestryDetails> destryDetailsByInventoryNumber;
    private Drug drugByDrugId;
    private Collection<OutboundDetails> outboundDetailsByInventoryNumber;
    private Collection<Pandian> pandiansByInventoryNumber;
    private Collection<PublicdurgDetails> publicdurgDetailsByInventoryNumber;
    private Collection<PutInStorageDetails> putInStorageDetailsByInventoryNumber;
    private Collection<ReturnGoodsDetails> returnGoodsDetailsByInventoryNumber;
    private Collection<TuiyaoDetails> tuiyaoDetailsByInventoryNumber;

    @Id
    @Column(name = "inventory_number", nullable = false)
    public int getInventoryNumber() {
        return inventoryNumber;
    }

    public void setInventoryNumber(int inventoryNumber) {
        this.inventoryNumber = inventoryNumber;
    }

    @Basic
    @Column(name = "inventory_quantity", nullable = true, precision = 0)
    public Long getInventoryQuantity() {
        return inventoryQuantity;
    }

    public void setInventoryQuantity(Long inventoryQuantity) {
        this.inventoryQuantity = inventoryQuantity;
    }

    @Basic
    @Column(name = "inventory_k_f", nullable = true, precision = 0)
    public Integer getInventoryKF() {
        return inventoryKF;
    }

    public void setInventoryKF(Integer inventoryKF) {
        this.inventoryKF = inventoryKF;
    }

    @Basic
    @Column(name = "inventory_m_z", nullable = true, precision = 0)
    public Integer getInventoryMZ() {
        return inventoryMZ;
    }

    public void setInventoryMZ(Integer inventoryMZ) {
        this.inventoryMZ = inventoryMZ;
    }

    @Basic
    @Column(name = "inventory_details_batch", nullable = true, precision = 0)
    public Long getInventoryDetailsBatch() {
        return inventoryDetailsBatch;
    }

    public void setInventoryDetailsBatch(Long inventoryDetailsBatch) {
        this.inventoryDetailsBatch = inventoryDetailsBatch;
    }

    @Basic
    @Column(name = "inventory_details_quantity", nullable = true, precision = 0)
    public Long getInventoryDetailsQuantity() {
        return inventoryDetailsQuantity;
    }

    public void setInventoryDetailsQuantity(Long inventoryDetailsQuantity) {
        this.inventoryDetailsQuantity = inventoryDetailsQuantity;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Inventory inventory = (Inventory) o;
        return inventoryNumber == inventory.inventoryNumber &&
                Objects.equals(inventoryQuantity, inventory.inventoryQuantity) &&
                Objects.equals(inventoryKF, inventory.inventoryKF) &&
                Objects.equals(inventoryMZ, inventory.inventoryMZ) &&
                Objects.equals(inventoryDetailsBatch, inventory.inventoryDetailsBatch) &&
                Objects.equals(inventoryDetailsQuantity, inventory.inventoryDetailsQuantity);
    }

    @Override
    public int hashCode() {
        return Objects.hash(inventoryNumber, inventoryQuantity, inventoryKF, inventoryMZ, inventoryDetailsBatch, inventoryDetailsQuantity);
    }

    @OneToMany(mappedBy = "inventoryByInventoryNumber")
    public Collection<DestryDetails> getDestryDetailsByInventoryNumber() {
        return destryDetailsByInventoryNumber;
    }

    public void setDestryDetailsByInventoryNumber(Collection<DestryDetails> destryDetailsByInventoryNumber) {
        this.destryDetailsByInventoryNumber = destryDetailsByInventoryNumber;
    }

    @ManyToOne
    @JoinColumn(name = "drug_id", referencedColumnName = "drug_id")
    public Drug getDrugByDrugId() {
        return drugByDrugId;
    }

    public void setDrugByDrugId(Drug drugByDrugId) {
        this.drugByDrugId = drugByDrugId;
    }

    @OneToMany(mappedBy = "inventoryByInventoryNumber")
    public Collection<OutboundDetails> getOutboundDetailsByInventoryNumber() {
        return outboundDetailsByInventoryNumber;
    }

    public void setOutboundDetailsByInventoryNumber(Collection<OutboundDetails> outboundDetailsByInventoryNumber) {
        this.outboundDetailsByInventoryNumber = outboundDetailsByInventoryNumber;
    }

    @OneToMany(mappedBy = "inventoryByInventoryNumber")
    public Collection<Pandian> getPandiansByInventoryNumber() {
        return pandiansByInventoryNumber;
    }

    public void setPandiansByInventoryNumber(Collection<Pandian> pandiansByInventoryNumber) {
        this.pandiansByInventoryNumber = pandiansByInventoryNumber;
    }

    @OneToMany(mappedBy = "inventoryByInventoryNumber")
    public Collection<PublicdurgDetails> getPublicdurgDetailsByInventoryNumber() {
        return publicdurgDetailsByInventoryNumber;
    }

    public void setPublicdurgDetailsByInventoryNumber(Collection<PublicdurgDetails> publicdurgDetailsByInventoryNumber) {
        this.publicdurgDetailsByInventoryNumber = publicdurgDetailsByInventoryNumber;
    }

    @OneToMany(mappedBy = "inventoryByInventoryNumber")
    public Collection<PutInStorageDetails> getPutInStorageDetailsByInventoryNumber() {
        return putInStorageDetailsByInventoryNumber;
    }

    public void setPutInStorageDetailsByInventoryNumber(Collection<PutInStorageDetails> putInStorageDetailsByInventoryNumber) {
        this.putInStorageDetailsByInventoryNumber = putInStorageDetailsByInventoryNumber;
    }

    @OneToMany(mappedBy = "inventoryByInventoryNumber")
    public Collection<ReturnGoodsDetails> getReturnGoodsDetailsByInventoryNumber() {
        return returnGoodsDetailsByInventoryNumber;
    }

    public void setReturnGoodsDetailsByInventoryNumber(Collection<ReturnGoodsDetails> returnGoodsDetailsByInventoryNumber) {
        this.returnGoodsDetailsByInventoryNumber = returnGoodsDetailsByInventoryNumber;
    }

    @OneToMany(mappedBy = "inventoryByInventoryNumber")
    public Collection<TuiyaoDetails> getTuiyaoDetailsByInventoryNumber() {
        return tuiyaoDetailsByInventoryNumber;
    }

    public void setTuiyaoDetailsByInventoryNumber(Collection<TuiyaoDetails> tuiyaoDetailsByInventoryNumber) {
        this.tuiyaoDetailsByInventoryNumber = tuiyaoDetailsByInventoryNumber;
    }
}
